package com.itcam.wemedia.controller.v1;


import com.itcam.model.common.dtos.CommentConfigDto;
import com.itcam.model.common.dtos.CommentRepaySaveDto;
import com.itcam.model.common.dtos.ResponseResult;
import com.itcam.wemedia.service.CommentManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/comment/manage")
public class CommentManageController {

    @Autowired
    private CommentManageService commentManageService;


    /**
     * 删除评论
     * @param commentId
     * @return
     */
    @DeleteMapping("/del_comment/{commentId}")
    public ResponseResult delComment(@PathVariable("commentId") String commentId) {
        return commentManageService.delComment(commentId);
    }

    /**
     * 删除评论回复
     * @param commentRepayId
     * @return
     */
    @DeleteMapping("/del_comment_repay/{commentRepayId}")
    public ResponseResult delCommentRepay(@PathVariable("commentRepayId") String commentRepayId) {
        return commentManageService.delCommentRepay(commentRepayId);
    }

    /**
     * 回复评论
     * @param dto
     * @return
     */
    @PostMapping("/comment_repay")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepaySaveDto dto) {
        return commentManageService.saveCommentRepay(dto);
    }

    /**
     * 打开或关闭评论
     * @param dto
     * @return
     */
    @PostMapping("/update_comment_status")
    public ResponseResult updateCommentStatus(@RequestBody CommentConfigDto dto) {
        return commentManageService.updateCommentStatus(dto);
    }


}